home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
hex
/
mainfrm.frm
< prev
next >
Wrap
Text File
|
1999-10-12
|
11KB
|
428 lines
VERSION 4.00
Begin VB.Form mainfrm
BorderStyle = 3 'Fixed Dialog
Caption = "HEX Guru v1.0"
ClientHeight = 2730
ClientLeft = 1410
ClientTop = 1770
ClientWidth = 5640
Height = 3135
Left = 1350
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
MousePointer = 1 'Arrow
ScaleHeight = 182
ScaleMode = 3 'Pixel
ScaleWidth = 376
ShowInTaskbar = 0 'False
Top = 1425
Width = 5760
Begin VB.CommandButton cmdcopy
Caption = "Copy HEX"
Height = 255
Left = 1440
TabIndex = 15
Top = 1440
Width = 1215
End
Begin VB.OptionButton opt2
Caption = "Back color"
Height = 255
Left = 4440
TabIndex = 9
Top = 2400
Width = 1095
End
Begin VB.OptionButton opt1
Caption = "Text color"
Height = 255
Left = 4440
TabIndex = 8
Top = 2160
Value = -1 'True
Width = 1095
End
Begin VB.HScrollBar bluescroll
Height = 255
Left = 720
Max = 255
TabIndex = 4
Top = 2400
Width = 1575
End
Begin VB.HScrollBar greenscroll
Height = 255
Left = 720
Max = 255
TabIndex = 3
Top = 2160
Width = 1575
End
Begin VB.HScrollBar redscroll
Height = 255
Left = 720
Max = 255
TabIndex = 2
Top = 1920
Width = 1575
End
Begin VB.TextBox maintext
Height = 2295
Left = 2760
MultiLine = -1 'True
TabIndex = 0
Text = "mainfrm.frx":0000
Top = 360
Width = 2775
End
Begin VB.Line Line1
X1 = 8
X2 = 192
Y1 = 24
Y2 = 24
End
Begin VB.Label Label7
Caption = "HEX Guru v1.0"
Height = 195
Left = 120
TabIndex = 18
Top = 120
Width = 1785
End
Begin VB.Label Label6
Caption = "Written by Etienne Blythe"
Height = 195
Left = 120
TabIndex = 17
Top = 720
Width = 1785
End
Begin VB.Label Label1
Caption = "http://stormloader.com/nearworlds"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 195
Left = 120
TabIndex = 16
Top = 960
Width = 2460
End
Begin VB.Label hextext
Caption = "#000000"
Height = 255
Left = 600
TabIndex = 14
Top = 1440
Width = 735
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "HEX:"
Height = 195
Left = 120
TabIndex = 13
Top = 1440
Width = 375
End
Begin VB.Label bluetext
Alignment = 1 'Right Justify
Caption = "255"
Height = 255
Left = 2400
TabIndex = 12
Top = 2400
Width = 255
End
Begin VB.Label greentext
Alignment = 1 'Right Justify
Caption = "255"
Height = 255
Left = 2400
TabIndex = 11
Top = 2160
Width = 255
End
Begin VB.Label redtext
Alignment = 1 'Right Justify
Caption = "255"
Height = 255
Left = 2400
TabIndex = 10
Top = 1920
Width = 255
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "Blue:"
Height = 195
Left = 120
TabIndex = 7
Top = 2400
Width = 360
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "Green:"
Height = 195
Left = 120
TabIndex = 6
Top = 2160
Width = 480
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "Red:"
Height = 195
Left = 120
TabIndex = 5
Top = 1920
Width = 345
End
Begin VB.Label Lable1
AutoSize = -1 'True
Caption = "Sample text:"
Height = 195
Left = 2760
TabIndex = 1
Top = 120
Width = 870
End
End
Attribute VB_Name = "mainfrm"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Private Sub bluescroll_Change()
If opt1.Value = True Then
maintext.ForeColor = RGB(redscroll.Value, greenscroll.Value, bluescroll.Value)
redtext = redscroll.Value
greentext = greenscroll.Value
bluetext = bluescroll.Value
textred = redscroll.Value
textgreen = greenscroll.Value
textblue = bluescroll.Value
ElseIf opt2.Value = True Then
maintext.BackColor = RGB(redscroll.Value, greenscroll.Value, bluescroll.Value)
redtext = redscroll.Value
greentext = greenscroll.Value
bluetext = bluescroll.Value
backred = redscroll.Value
backgreen = greenscroll.Value
backblue = bluescroll.Value
End If
Dim lCol As Long
Dim iRed, iGreen, iBlue As Integer
Dim vHexR, vHexG, vHexB As Variant
'Break out the R, G, B values from the common dialog color
lCol = lCdlColor
iRed = redscroll.Value Mod &H100
lCol = lCol \ &H100
iGreen = greenscroll.Value Mod &H100
lCol = lCol \ &H100
iBlue = bluescroll.Value Mod &H100
'Determine Red Hex
vHexR = Hex(iRed)
If Len(vHexR) < 2 Then
vHexR = "0" & vHexR
End If
'Determine Green Hex
vHexG = Hex(iGreen)
If Len(vHexG) < 2 Then
vHexG = "0" & iGreen
End If
'Determine Blue Hex
vHexB = Hex(iBlue)
If Len(vHexB) < 2 Then
vHexB = "0" & vHexB
End If
'Add it up, return the function value
hextext.Caption = "#" & vHexR & vHexG & vHexB
End Sub
Private Sub cmdcopy_Click()
Clipboard.SetText hextext.Caption
maintext.Text = "HEX copied!"
End Sub
Private Sub Form_Load()
Static textred, textgreen, textblue
Static backred, backgreen, backblue
textred = 0
textgreen = 0
textblue = 0
backred = 0
backgreen = 0
backblue = 0
End Sub
Private Sub greenscroll_Change()
If opt1.Value = True Then
maintext.ForeColor = RGB(redscroll.Value, greenscroll.Value, bluescroll.Value)
redtext = redscroll.Value
greentext = greenscroll.Value
bluetext = bluescroll.Value
textred = redscroll.Value
textgreen = greenscroll.Value
textblue = bluescroll.Value
ElseIf opt2.Value = True Then
maintext.BackColor = RGB(redscrol